import { createRouter, createWebHistory } from 'vue-router'
import HomeView from '../views/HomeView.vue'

const router = createRouter({
  history: createWebHistory(import.meta.env.BASE_URL),
  routes: [
    {
      path: '/',
      name: 'home',
      component: HomeView,
    },
    {
      path: '/about',
      name: 'about',
      // route level code-splitting
      // this generates a separate chunk (About.[hash].js) for this route
      // which is lazy-loaded when the route is visited.
      component: () => import('../views/AboutView.vue'),
      children:[
        {
          path:'/insertUser',
          name:'insertUser',
          component: () => import('../views/InsertUser.vue'),
        },
        {
          path:'/insertRole',
          name:'insertRole',
          component: () => import('../views/InserRole.vue'),
        },
        {
          path:'/insertPermission',
          name:'insertPermission',
          component: () => import('../views/InsertPermission.vue'),
        },
        {
          path:'/showUser',
          name:'showUser',
          component: () => import('../views/ShowUser.vue'),
        },
        {
          path:'/showRole',
          name:'showRole',
          component: () => import('../views/ShowRole.vue'),
        },
        {
          path:'/showPermission',
          name:'showPermission',
          component: () => import('../views/ShowPermission.vue'),
        },
        {
          path:'/editUser/:id',
          name:'editUser',
          component: () => import('../views/EditUser.vue'),
        },
        {
          path:'/editRole/:id',
          name:'editRole',
          component: () => import('../views/EditRole.vue'),
        },
        {
          path:'/editPermission/:id',
          name:'editPermission',
          component: () => import('../views/EditPermission.vue'),
        },
      ]
    },
  ],
})

export default router
